﻿@using System.Collections.Generic;
@using Think.Lenovo.Com.Models;
@using Think.Lenovo.Com.Models.Users;
@using System.Web.Mvc;
@using System.Web.Mvc.Html;
<link href="/Contents/css/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-Control" content="no" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
}
-->
</style>
<script type="text/javascript" src="/Scripts/lib/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/Scripts/lib/SerializeObject.js"></script>
<script type="text/javascript" src="/Scripts/ViewGrantPower.js"></script>
<body>
    <div>
        请勾选下面权限,为角色 xxx 授权
        <input type="hidden" id="roleId" value="@ViewData["roleId"]" />
        <input type="button" onclick="grantPowerToUser()" value="授权" />
    </div>
    <hr />
    <table id="userList" style="table-layout: auto;" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td>
            </td>
            <td align="center">
                <font color='green'>权限编码</font>
            </td>
            <td>
                <font color='green'>权限名称</font>
            </td>
            <td align="center">
                <font color='green'>权限描述</font>
            </td>
        </tr>
        @{
            foreach (PowerModel p in (LinkedList<PowerModel>)ViewData["list"])
            {
            <tr>
                <td>
                    @{
                String isChecked = String.Empty;
                foreach (RolePowerRelationModel m in (LinkedList<RolePowerRelationModel>)ViewData["rolePowers"])
                {
                    if (m.PowerId == p.Id)
                    {
                        isChecked = "checked=\"checked\"";
                        break;
                    }
                }
                        <input type="checkbox" @isChecked name="powerId" value="@p.Id" />
                    }
                </td>
                <td align="center">
                    <font color='green'>@p.Code</font>
                </td>
                <td>
                    <font color='green'>@p.Name</font>
                </td>
                <td align="center">
                    <font color='green'>@p.Description</font>
                </td>
            </tr>
            }
        }
    </table>
</body>
